import {defineStore} from "pinia";
import {reqGoodsList} from "@/api";
import {ref} from "vue";

export const useGoodsStore = defineStore('goods', () => {

    const goodsList = ref([])
    const pageInfo = ref({})

    async function loadGoodsList(param) {
        const resp = await reqGoodsList(param)
        goodsList.value = resp.data.records
        pageInfo.value = resp.data.pageInfo
    }

    return {
        goodsList,
        pageInfo,
        loadGoodsList
    }
})
